home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / GameSprocket SDKs / DrawSprocket_SDK / DSp Debugging Tips < prev    next >
Encoding:
Text File  |  1999-10-29  |  4.0 KB  |  84 lines  |  [ttro/ttxt]

  1. ********************************************************************************
  2.  
  3.                    Debugging Tips for DrawSprocket Developers
  4.                   
  5.                         Last Updated: October 28, 1998
  6.  
  7. ********************************************************************************
  8.  
  9. This file contains some useful tips for debugging your games that are using
  10. DrawSprocket. It is compiled from questions and issues that are brought to our
  11. attention regularly, so please read and use this information before reporting
  12. problems to Apple.
  13.  
  14. If you find that none of the suggestions here address the problem, send a bug
  15. report using the bug reporter on Apple Developer Connection:
  16.  
  17. <http://developer.apple.com/bugreporter/index.html>
  18.  
  19. -  Use the DrawSprocketDebugLib for all your development.  It will flag
  20.    problems by dropping you into MacsBug with warning messages that describe
  21.    what you did wrong.
  22.  
  23. -     Make sure you have the latest DrawSprocket. Verify this by going to
  24.    <http://developer.apple.com/dev/games> and comparing the version of what
  25.    you have against what is available.
  26.  
  27. -  Check for multiple copies of DrawSprocket on your machine.  You may be
  28.    running against one you aren't expecting, and it may be older.
  29.     
  30. -  Use debug mode to stop DSp from gamma fading and showing the blanking
  31.    window.  This can be done programmatically with the DSpSetDebugMode() call,
  32.    or by creating a folder in the same directory as your game called
  33.    "DSpSetDebugMode".    Debug mode only works with the debug build of DSp, and
  34.    comes in *very* useful when you drop into the debugger when the screen is
  35.    faded out.
  36.  
  37. -  Check the return codes from all DrawSprocket calls.  DSp returns valuable
  38.    information in the return codes, and your game really shouldn't ignore
  39.    them. If you ignore them and something bad happens, you're probably going
  40.    to crash.
  41.     
  42. -  Compare how you are doing things with how the available sample source
  43.    code does things.  You might spot a subtlety that you missed before.
  44.     
  45. -  Make sure your application has a large enough heap to run AND allocate
  46.    your graphics pages.  To roughly calculate the amount of memory used by DSp
  47.    (on your behalf), figure:
  48.     
  49.       page_size = width * height * pixel_byte_size
  50.       allocated memory = ( page_count - 1 ) * page_size
  51.         
  52.    This is a generalization, but should handle the worst case scenario.  If
  53.    you are allocating a 640x480 8 bit context with a page count, you would get:
  54.     
  55.       page_size = 640 * 480 * 1 = 300k
  56.       allocated memory = ( 2 - 1 ) * 300k, or 300k.
  57.         
  58.    Additional memory is required for AltBuffers, etc.
  59.     
  60. -  Try eliminating sections of code until you can track down a statement that
  61.    causes the bad behavior to manifest.  For example, if you find that you are
  62.    getting an address exception at a given point in your program, try
  63.    eliminating code sections from the execution path until the address
  64.    exception doesn't occur.  This will often lead you directly to a memory
  65.    trashing bug.
  66.     
  67. -  If you have installed the Display Manger manually (pre 7.5.3 systems), make
  68.    sure you are using the "Display Library" shared library, and not the
  69.    "DisplayLib" shared library.  "DisplayLib", while having the same file name
  70.    as the desired code fragment, is actually a linker stub library.  It is
  71.    supposed to have a file type of 'stub', but it doesn't, and that's wrong,
  72.       and CFM will try to link your program to it.
  73.  
  74. -  If you set the page flipping flag in your application, test your code on a
  75.    machine capable of page flipping before you ship.  Some applications have
  76.    shipped with bugs because they did not do proper testing.  Applications should
  77.    make sure they call DSpContext_GetBackBuffer every frame, and also ensure that
  78.    they properly update any underlay buffers using DSpAltBuffer_InvalRect.
  79.  
  80.    A good machine to test is any 7500/7600/8500/8600 with 4 megabytes of VRAM.
  81.  
  82. -  If you have at least version 1.1.3 of DrawSprocket you can call
  83.    DSpUserSelectContext() on a single-monitor system if you turn on debug mode.
  84.